import json
import pytest


def read_json(file_path):
    '''
    解析json数据，返回的数据格式为[[],[],...,[]]
    :param file_path: json文件路径
    :return:
    '''
    with open(file_path, 'r', encoding="utf-8") as f:
        examples: dict = json.load(f)
        print("data: ", examples)
        data = [] # 保存所有测试数据
        for example in examples.values():
            values = [] # 单条测试数据
            for key, value in example.items():
                values.append(value)
            data.append(values)
        print(data)
        # data文件数据结构：[["name", "tom"], ["age", 18], ["sex", "male"]]
        return data


if __name__ == '__main__':
    file_path = "../data/single/wlkt/plan_assignment_controller/search.json"
    data = read_json(file_path)
    print(data)
